package org.linlinjava.litemall.core.exception;

public class BusinessRuntimeException extends RuntimeException {
	
	private static final long serialVersionUID = -6049067846725388930L;

	public static final int DEFAULT_ERROR_CODE = 50000;
	
	public static final String DEFAULT_ERROR_MESSAGE = "未知系统错误";
	
	/** 
	 * 异常代码
	 */
	private Integer code;

	public BusinessRuntimeException(String message) {
		this(DEFAULT_ERROR_CODE, message, null);
	} 
	
	public BusinessRuntimeException(Throwable cause) {
		this(DEFAULT_ERROR_CODE, DEFAULT_ERROR_MESSAGE, cause);
	} 
	
	public BusinessRuntimeException(Integer code) {
		this(code, DEFAULT_ERROR_MESSAGE, null);
	} 
	
	public BusinessRuntimeException(Integer code, String msg) {
		this(code, msg, null);
	} 
	
	public BusinessRuntimeException(Integer code, Throwable cause) {
		this(code, DEFAULT_ERROR_MESSAGE, cause);
	} 
	
	public BusinessRuntimeException(Integer code, String msg, Throwable cause) {
		super(msg, cause);
		this.code = code;
	} 
	
	public Integer getCode() {
		return code;
	}

	public void setCode(Integer code) {
		this.code = code;
	}

}
